<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">

		<title>新增排片</title>
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/bootstrap.css">
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/theme.css">
		<script src="<%=basePath%>jquery/jquery.min.js"
			type="text/javascript"></script>
	   <script type="text/javascript">
	   $(function(){
			  //ajax获取后台影城数据
					$.get("/cinema/select",function(data){
						$.each(data, function(i, item){
							$(".mulname").append("<option value='"+ item.fcId+"'>"+ item.fcName+"</option>"); 
						});
							
					},"json");
			  //把影城的id给了影厅
			    $(".mulname").change(function(){
       	           var url = "/screen/select";
       	           var args = $(this).val();
       	           //清空影厅
       	           $(".sname").empty();
       	           //Ajax获取影厅信息。
       	           $.getJSON(url,{id:args},function(data){
	       	        	$.each(data, function(i, item){
							$(".sname").append("<option value='"+ item.screenid+"'>"+ item.screenname+"</option>"); 
						});
       	           })     
                })	
                
            //从后台读取电影信息。
                $.getJSON("/film/select",function(data){
       	        	$.each(data, function(i, item){
						$(".fname").append("<option value='"+ item.filmId+"'>"+ item.filmName+"</option>"); 
					});
   	           }) 
		});
	 
		</script>		
	</head>

	<body class="content1">
		<div class="header">
			<h1 class="page-title">
				新增排片
			</h1>
		</div>

		<ul class="breadcrumb">
			<li>
				<a href="index.html">排片管理</a>
				<span class="divider">/</span>
			</li>
			<li class="active">
				新增排片
			</li>
		</ul>

		<div class="container-fluid">
			<div class="row-fluid">
				<form method="post" action="<%=basePath%>planfilm/add">
					<div class="btn-toolbar">
						<input type="submit" class="btn btn-primary" value="保存 ">
						<a href="<%=basePath%>planfilm/list" class="btn">取消</a>

					</div>

					<div class="well">
						<div class="tab-pane active in">
						    <label>
								请先选择排片的影城,影厅 名称：
							</label>
						    <select name="fcId" class="mulname" required>
							    <option value="">
								           请选择...
								 </option>
							</select>

						    <select name="screenid" class="sname" required>
							    <option value="">
								           请选择...
								 </option>
							</select>
							<label>
								排片的电影名称：
							</label>
						    <select name="filmId" class="fname" required>
							    <option value="">
								           请选择...
								 </option>
							</select>
						    <label>
								排片记录：
							</label>
							<input type="text" name="record" maxlength="100" required
							placeholder="xx时间在xx号厅开始xx电影">
							<label>
								排片时间：
							</label>
							<input type="date" name="startdate" maxlength="100" required>
							<div style="color: red">
								${msg}
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>
